package com.system.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@JsonInclude(value = JsonInclude.Include.NON_NULL)

public class ResourceDto implements Serializable {

    /**
    * id
    */
    private String id;

    /**
    * 名称|菜单或按钮
    */
    @Length(max =100 ,message = "长度不能超过100位")
    @NotEmpty(message = "名称|菜单或按钮必填")
    private String name;
    /**
    * 页面|路由
    */
    @Length(max =50 ,message = "长度不能超过50位")
    @JsonInclude(value = JsonInclude.Include.NON_EMPTY)
    private String page;
    //图标
    private String icon;
    //排序
    private Integer sort;
    private  Integer isShow;

    private String isCached;
    //1代表菜单，2代表权限
    private  Integer category;
    //页面文件路径
    private  String path;
    //权限标记
    private String perms;
    /**
    * 请求|接口
    */
    @Length(max =200 ,message = "长度不能超过200位")
    private String request;

    private Integer linkType;
    /**
    * 父id
    */
    private String parent;
    private List<ResourceDto> children;
    /**
    * 创建时间
    */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getSort() {
        return sort;
    }

    public Integer getIsShow() {
        return isShow;
    }

    public void setIsShow(Integer isShow) {
        this.isShow = isShow;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getCategory() {
        return category;
    }

    public void setCategory(Integer category) {
        this.category = category;
    }

    public String getId() {
    return id;
    }

    public void setId(String id) {
    this.id = id;
    }

    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }

    public String getPage() {
    return page;
    }

    public void setPage(String page) {
    this.page = page;
    }

    public String getRequest() {
    return request;
    }

    public void setRequest(String request) {
    this.request = request;
    }

    public String getParent() {
    return parent;
    }

    public void setParent(String parent) {
    this.parent = parent;
    }

    public Date getCreateTime() {
    return createTime;
    }

    public void setCreateTime(Date createTime) {
    this.createTime = createTime;
    }

    public List<ResourceDto> getChildren() {
        return children;
    }

    public void setChildren(List<ResourceDto> children) {
        this.children = children;
    }

    public Integer getLinkType() {
        return linkType;
    }

    public void setLinkType(Integer linkType) {
        this.linkType = linkType;
    }

    public String getIsCached() {
        return isCached;
    }

    public void setIsCached(String isCached) {
        this.isCached = isCached;
    }

    @Override
    public String toString() {
        String sb = getClass().getSimpleName() +
                " [" +
                "Hash = " + hashCode() +
                ", id=" + id +
                ", name=" + name +
                ", page=" + page +
                ", request=" + request +
                ", parent=" + parent +
                ", createTime=" + createTime +
                "]";
        return sb;
        }

}